package javacafe.daoimpl;

import java.sql.SQLException;
import java.util.List;

import javacafe.dto.popup.PopupDTO;
import javacafe.dao.PopupDAO;
import javacafe.ibatis.SqlDaoSuport;

public class PopupDAOImple extends SqlDaoSuport implements PopupDAO {
	
	@Override
	public List<PopupDTO> getPopupList(String popupname) {
		List<PopupDTO> list = null;
		try {
			list =  (List<PopupDTO>)getSqlMapper().queryForList("getPopupList", popupname);
			System.out.println(list);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return list;
	}
	
	@Override
	public boolean createPopup(PopupDTO dto) {
		try{
			this.getSqlMapper().insert("createPopup", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}
	
	@Override
	public boolean updatePopup(PopupDTO dto) {
		try{
			this.getSqlMapper().insert("updatePopup", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}
	
	@Override
	public boolean deletePopup(PopupDTO dto) {
		try{
			this.getSqlMapper().insert("deletePopup", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}


}
